<?php

namespace support\Service;

use support\Backend\BackendService;
use support\Container;
use support\Db;
use support\Model\DictDataModel;

class DictDataService extends BackendService
{
    public function __construct()
    {
        $this->model = Container::get(DictDataModel::class);
    }

    public function getUserCountByWhere($where)
    {
        return $this->model->getCountByWhere($where);
    }

    public function getListByDictId($dict_id)
    {
        return $this->model->select([Db::raw('name as label'), Db::raw('code as value')])->where('dict_id', $dict_id)->where('mark', 1)->get()->toArray();
    }

}